package com.ylr.basic.framework.controller.web;

import java.util.List;
import java.util.Map;

import com.ylr.basic.framework.entity.EphemeralDataEntity;
import com.ylr.basic.framework.service.EphemeralDataService;
import com.ylr.base.common.tool.Result;
import lombok.AllArgsConstructor;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import org.springframework.web.bind.annotation.*;

/**
 * Created by IntelliJ IDEA.
 *
 * @author wyw
 * date: 2023-07-06 22:41:05
 * className: EphemeralDataWebController
 * version: 1.0
 * description:
 */
@RestController
@RequestMapping("/web/ephemeral-data")
@AllArgsConstructor
public class EphemeralDataWebController {

    private static final Logger log = LoggerFactory.getLogger(EphemeralDataWebController.class);

    private EphemeralDataService ephemeralDataService;

    /**
     * 保存
     */
    @PostMapping("/save")
    public Result<Object> saveEphemeralData(@RequestBody EphemeralDataEntity ephemeralData) {
//        ephemeralDataService.save(ephemeralData);

        return Result.success();
    }

    /**
     * 列表
     */
    @GetMapping("/page/list")
    public Result<Object> pageEphemeralDataList(@RequestParam Map<String, Object> params) {
//        PageUtils page = ephemeralDataService.queryPage(params);

        return Result.success();
    }


    /**
     * 信息
     */
    @GetMapping("/get")
    public Result<Object> getEphemeralData(@RequestParam("id") Long id) {
//		EphemeralDataEntity ephemeralData = ephemeralDataService.getById(id);

        return Result.success();
    }

    /**
     * 修改
     */
    @PostMapping("/update")
    public Result<Object> updateEphemeralData(@RequestBody EphemeralDataEntity ephemeralData) {
//		ephemeralDataService.updateById(ephemeralData);

        return Result.success();
    }

    /**
     * 删除临时数据接口
     * @param idList 主键列表
     * @return 结果
     */
    @DeleteMapping("/delete")
    public Result<Object> deleteEphemeralData(@RequestBody List<Long> idList) {
        log.info("api => 开始删除临时数据操作。idList={}", idList);

        ephemeralDataService.deleteEphemeralData(idList);

        log.info("api => 删除临时数据操作结束");
        return Result.success();
    }

}
